<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tabs测试</title>
    <script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="../js/easyui/themes/default/easyui.css"/>
    <link rel="stylesheet" href="../js/easyui/themes/icon.css">
    <!--引入ztree -->
    <script type="text/javascript" src="../js/ztree/jquery.ztree.all-3.5.js"></script>
    <link rel="stylesheet" href="../js/ztree/zTreeStyle.css">
    <script type="text/javascript">
        //页面加载后执行
        $(function () {
            //1.进行ztree菜单设置
            var setting={
                data:{
                    simpleData:{
                        enable:true //允许简单json数据格式
                    }
                },
                callback:{
                    onClick:function(event, treeId, treeNode, clickFlag){
                        var content = '<div style="width:100%;height:100%;overflow:hidden;">'
                                + '<iframe src="'
                                + treeNode.page
                                + '" scrolling="auto" style="width:100%;height:100%;border:0;" ></iframe></div>';
                        //没有树形结构,不打开选项卡
                        if(treeNode.page!=undefined && treeNode.page!=""){
                            //如果选项卡打开,选中
                            if($("#mytabs").tabs("exists",treeNode.name)){
                                //选中
                                $("#mytabs").tabs("select",treeNode.name)
                            }else{
                                //如果没有
                                $("#mytabs").tabs("add",{
                                    title:treeNode.name,
                                    content:content,
                                    closable:true
                                });


                            }
                        }

                    }
                }

            };
        //2.提供ztree树形菜单
        var zNodes=[
            {id:1,pId:0,name:"父节点一"},
            {id:2,pId:0,name:"父节点二"},
            {id:11,pId:1,name:"子节点一"},
            {id:12,pId:1,name:"子节点二"},
            {id:21,pId:2,name:"百度",page:"https://www.baidu.com"},
            {id:22,pId:2,name:"黑马",page:"http://www.itheima.com"}
        ];
        //3.生成菜单
        $.fn.zTree.init($("#baseMenu"),setting,zNodes);
        });


    </script>
</head>
<body class="easyui-layout">
<div data-options="region:'north', title:'速运物流后台管理系统'" style="height: 100px">北部区域</div>
<div data-options="region:'west',title:'菜单导航'" style="width: 200px">
    <!--折叠面板-->
    <div class="easyui-accordion" data-options="fit:true">
        <div data-options="title:'基础菜单'">
            <!--通过ztree生成树菜单-->
            <ul id="baseMenu" class="ztree"></ul>
        </div>
        <div data-options="title:'系统菜单'">折叠面板二</div>
    </div>

</div>
<div data-options="region:'center'">
    <div class="easyui-tabs" id="mytabs" data-options="fit:true">
        <div data-options="title:'系统通知'"></div>
        <div  data-options="title:'选项卡一',closable:true"></div>
        <div data-options="title:'选项卡二',closable:true"></div>
    </div>


</div>
<div data-options="region:'east'" style="width: 80px">东部区域</div>
<div data-options="region:'south'" style="height: 80px">南部区域</div>

</body>
</html>